package com.zgh.message.service;

import com.xxg.base.module.Operater;
import com.xxg.base.module.Page;
import com.xxg.base.service.IBaseService;
import com.xxg.exception.BaseException;
import com.zgh.message.module.MyMessage;
import com.zgh.message.module.SystemMessage;

import java.util.List;
import java.util.Map;

public interface ISystemMessageService extends IBaseService<SystemMessage, Long> {
    
    public static final String SCHEDULE = "日程消息";        //日程管理
    public static final String DINNER = "业务消息";        //就餐管理
    public static final String NOTICE = "通知公告消息";        //通知公告消息
    public static final String REPORT = "业务消息";        //日报
    public static final String LEAVE= "业务消息";        //日报
    public static final String WORKFLOW="流程消息";	//流程消息
    
    public static final String NOTICE_SYS = "0";        //系统消息
    public static final String NOTICE_MSG = "1";        //短信通知
    public static final String NOTICE_EMAIL = "2";        //电子邮件
    public static final String NOTICE_INSTANT = "3";    //及时通讯

    public static final int MAX_PERSON_COUNT = 10000;  //一次性发送消息的人数限制
    public static final int MAX_SEND_MINUTE = 120;  //发送消息延迟时限

    public static final String CONTENT_SPLIT = "#_#";    //内容分隔符，用于标题和链接地址分隔

    public boolean sendMessage(String systemName, String businessType, String remindType, List<Long> userIdList, String subject, String content);

    public boolean sendMessage(Long sender, String systemName, String businessType, String remindType, List<Long> userIdList, String subject, String content);

    public boolean sendMessage(Long sender, String systemName, String businessType, String remindType, List<Long> userIdList, List<String> extendList, String subject, String content);

    public boolean sendMessage(String systemName, String businessType, String remindType, List<Long> userIdList, String subject, String content, Integer minute);

    public boolean sendMessage(Long sender, String systemName, String businessType, String remindType, List<Long> userIdList, String subject, String content, Integer minute);

    public boolean sendMessage(Long sender, String systemName, String businessType, String remindType, List<Long> userIdList, List<String> extendList, String subject, String content, Integer minute);

    /**
     * 发送即时通讯消息，用于在线沟通、通知或分享等
	 * @param sender 发送者ID,不可为空
	 * @param recver 接收者 用户，可多个，逗号隔开; 群组：群组ID，只能1个,不可为空
	 * @param url PC客户端气泡的详情页面 ,不可为空
	 * @param title 标题
	 * @param desc 描述
	 * @param icon 图标
	 * @param ctype 会话类型 0:单聊(默认) 1:群组 2:群发
	 * @param urlMobile 移动端的列表页面
	 * @param urlPc PC客户端的列表页面
	 * @param targetType 打开类型 1:内置浏览器(默认) 2:系统浏览器
	 * @param msgtype 消息类型 link(默认)
	 * @param extData 扩展数据
	 */
	public boolean sendCustomMessage(String sender, String recver, String url, String title,
                                     String desc, String icon, String ctype, String urlMobile, String urlPc, String targetType,
                                     String msgtype, String extData);
	
    
	
	/**
	 * 查询我的群
	 * @param userId
	 * @param key 查询条件
	 * @param pageIndex
	 * @param pageSize
	 * @return 群组json数据  {"count":100,"page":1,"page_size":20,"list":[{"id":100,"name":"固定群","intro":"固定群描述","user_limit":500,"user_count":100,"avatar":"","py_first":"gdq","py_full":"gudingqun","type":1,"status":1,"create_uid":"1","create_uname":"admin","create_time":1527563820,"update_time":1527563916},{"id":101,"name":"个人群","intro":"个人群描述","user_limit":200,"user_count":50,"avatar":"","py_first":"grq","py_full":"gerenqun","type":0,"status":1,"create_uid":"1","create_uname":"admin","create_time":1527563995,"update_time":0}]}
	 */
	public String  listGroups(String userId, String key, Integer pageIndex, Integer pageSize);
	
	/**
	 * 查询我的好友
	 * @param userId
	 * @param pageIndex
	 * @param pageSize
	 * @return 好友json数据  {"count":1,"page":1,"page_size":20,"list":[{"id":"100","name":"test1","mobile":"","email":"","intro":"","avatar":"","py_first":"t1","py_full":"test1","is_top":0,"group_id":""}]}
	 */
	public String  listFriends(String userId, Integer pageIndex, Integer pageSize);
	
    public void send();

    public Integer countMyMessage(Map<String, Object> params, Operater operater) throws BaseException;

    public Page<MyMessage> getMyMessagePage(Page<MyMessage> page, Operater operater) throws BaseException;

    public void updateSysStatus(String sendSys, String sendSysStatus, String sendSysTime, Long SystemMessageId, Long receiver);

    public void updateSysStatusByType(String sendSys, String sendSysStatus, String sendSysTime, List<String> typeList, Long receiver);

    public void updateSysStatusBatch(String sendSys, String sendSysStatus, String sendSysTime, List<String> idList, Long receiver);

    public List<Map<String, Object>> countUnReadMessage(Long receiver);
}
